package com.zsy.controller;

import com.zsy.entity.KeyCustomers;
import com.zsy.entity.MyClient;
import com.zsy.entity.PurchaseRequirements;
import com.zsy.service.ISalesService;
import com.zsy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/sales")
public class SalesController {
    @Autowired
    private ISalesService iss;

    // 新增客户
    @PostMapping("/addClient")
    public Result addClient(MyClient mc) {
        return iss.addClient(mc);
    }

    // 查询客户
    @GetMapping("/queryClient")
    public Result queryClient(){
        return iss.queryClient();
    }

    // 删除客户
    @PostMapping("/deleteClient")
    public Result deleteClient(int clientId){
        System.out.println(clientId);
        return iss.deleteClient(clientId);
    }

    // 新增采购需求
    @PostMapping("/addPurchaseRequirements")
    public Result addPurchaseRequirements(PurchaseRequirements pr){
        return iss.addPurchaseRequirements(pr);
    }

    // 查询合同列表
    @GetMapping("/selectContractAll")
    public Result selectContractAll(){
        return iss.selectContractAll();
    }

    // 联系情况
    @GetMapping("/getContactInformation")
    public Result getContactInformation(){
        return iss.getContactInformation();
    }

    // 重点客户跟进
    @GetMapping("/getKeyCustomers")
    public Result getKeyCustomers(){
        return iss.getKeyCustomers();
    }

    // 修改重点客户跟进
    @PostMapping("/updateKeyCustomers")
    public Result updateKeyCustomers(KeyCustomers keyCustomers){
        return iss.updateKeyCustomers(keyCustomers);
    }

    // 查询商机
    @GetMapping("/getBusinessManagement")
    public Result getBusinessManagement(){
        return iss.getAllBusiness();
    }

    // 排行榜
    @GetMapping("/rankingList")
    public Result rankingList(){
        return iss.rankingList();
    }

    // 查询客户总数
    @GetMapping("/getAllClientQuality")
    public Result getAllClientQuality(){
        return iss.getAllClientQuality();
    }

    //查询商机总数
    @GetMapping("/getAllBusinessQuantity")
    public Result getAllBusinessQuantity(){
        return iss.getAllBusinessQuantity();
    }
}
